package com.cloud.pole.rabbit;

import java.util.Date;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/*
*2019年5月18日
*cloud-weixin
*author:frank-chen
*/
@Component
public class Sender {
    @Autowired
    private AmqpTemplate rabbitTemplate;
    
    public void send() {
        String msg = "hello rabbitmq:"+new Date();
        System.out.println("Sender:"+msg);
        this.rabbitTemplate.convertAndSend("hello", msg);
    }
    
    public void send01() {
        String msg = "hello rabbitmq-01:"+new Date();
        System.out.println("Sender:"+msg);
        this.rabbitTemplate.convertAndSend("send01", msg);
    }
}